<?php

namespace catchAdmin\phone\model;

use catcher\exceptions\AlertErrorException;

class ZhaoPinBao extends \catchAdmin\model\ZhaoPinBao
{

    /**
     * 保存
     */
    public function saveData($param)
    {
        $this->startTrans();

        $this->saveDataApp($param);

        $this->commit();

        return 1;
    }


    ######################################## 显示 ################################################


    /**
     * 报名人员列表
     */
    public function indexBao($param)
    {
        $app = $this
            ->where('zhao_pin_id', $param['zhao_pin_id'])
            ->with(['userExt']);

        return $this->indexDataPcCC($param, $app);
    }


    /**
     * 报名人看已报名招聘列表
     */
    public function indexBaoSelf($param)
    {
        $app = $this
            ->with([
                'zhaoPin' => ['wechatUser'],
            ]);

        $list = $this->indexDataPcCC($param, $app);

        $list_2 = [];
        foreach ($list['data'] as $k => $v) {
            $tmp = $v['zhaoPin'];
            unset($v['zhaoPin']);
            $tmp['bao'] = $v;

            $list_2[] = $tmp;
        }
        $list['data'] = $list_2;

        return $list;
    }

}
